package Socket_Chat;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class SocketServer3 {
	
public static void main(String[] args) {
		
//		int port = Integer.valueOf(args[0]);
		int port = 7777;
		try {
			ServerSocket server = new ServerSocket(port);
			System.out.println("start server and listen port is " + port);
			ChatRoomThread chatRoomThread = new ChatRoomThread();
			
			while(true){
				Socket accept = server.accept();
				chatRoomThread.setSocket(accept);
				Thread thread = new Thread(chatRoomThread);
				thread.start();
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}
	
	
	
}
